package com.zmn.mcc.cas.server.model;

import com.zmn.common.utils.pager.Operator;
import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author tanghongjun
 * @since 2018/10/29 11:02
 */
@Data
public class StaffLoginDIO extends Operator implements Serializable {
    private static final long serialVersionUID = 3178167069634480398L;

    /**
     * 用户登录名或者手机号码
     */
    private String staffName;

    private String password;

    /**
     * 重定向地址
     */
    private String redirectUrl;

    /**
     * 验证码
     */
    private String vercode;

    /**
     * 设备
     */
    private String deviceType;

    /**
     * 钉钉二维码登录访问地址
     */
    private String qrCodeUrl;

    /**
     * 钉钉userId
     */
    private String dTalkUserId;

    /**
     * 免登临时授权code
     */
    private String authCode;

    /**
     * 是否跳转魔方系统标志
     */
    private Boolean cubeFlag;

    private Integer logId;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof StaffLoginDIO)) {
            return false;
        }
        StaffLoginDIO that = (StaffLoginDIO) o;
        return Objects.equals(getStaffName(), that.getStaffName()) && Objects.equals(getPassword(), that.getPassword()) && Objects.equals(getRedirectUrl(), that.getRedirectUrl()) && Objects.equals(getVercode(), that.getVercode()) && Objects.equals(getDeviceType(), that.getDeviceType());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getStaffName(), getPassword(), getRedirectUrl(), getVercode());
    }

    /**
     * 是否跳转到魔方系统
     * @return
     */
    public Boolean jumpToCube() {
        return cubeFlag != null && cubeFlag;
    }

    @Override
    public String toString() {
        return "StaffLogin{" + "staffName='" + staffName + '\'' + ", password='"
                + password + '\'' + ", redirectUrl='" + redirectUrl + '\''
                + ", vercode='" + vercode + '\'' + ", deviceType='" + deviceType + '\''
                + ", qrCodeUrl='" + qrCodeUrl + '\'' + ", dTalkUserId='" + dTalkUserId + '\''
                + ", authCode='" + authCode + '\'' + ", cubeFlag='" + cubeFlag + '\'' +'}';
    }
}
